﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Common;

namespace XMK.Framework.DataAccess
{
    /// <summary>
    /// 对象的填充委托
    /// </summary>
    /// <typeparam name="T">返回的对象类型</typeparam>
    /// <param name="t">返回的填充对象</param>
    /// <param name="dr">数据源</param>
    public delegate void DataRowFullInfoFun<T>(out T t, DataRow dr);

    /// <summary>
    /// 对象(有List的属性)的填充委托
    /// </summary>
    /// <typeparam name="T">返回的对象类型</typeparam>
    /// <param name="t">返回的填充对象</param>
    /// <param name="dr">数据源</param>
    /// <param name="ds">填充的对象中需要再填充的数据源</param>
    public delegate void DataRowFullInfoHaveListFun<T>(out T t, DataRow dr,DataSet ds);

    /// <summary>
    /// 取得参数的委托
    /// </summary>
    /// <returns></returns>
    public delegate IDbDataParameter[] GetDbParamsFun();

    /// <summary>
    /// 事务中后续命令需要之前命令结果并填充参数的委托
    /// </summary>
    /// <param name="i">当前运行的为第i个数据库操作</param>
    /// <param name="dbProvider">数据库驱动实例</param>
    /// <param name="dbCmdInfos">Sql命令实例集合</param>
    /// <returns>是否执行成功，若返回false则让事务回滚</returns>
    public delegate bool TransDbCmdFun(int i, DbProvider dbProvider, DbCmdInfo[] dbCmdInfos);
}
